//
//  ShareTabHeader.m
//  TenMinDemo
//
//  Created by Shawn Li on 2021/3/10.
//  Copyright © 2021 CYXiang. All rights reserved.
//

#import "ShareTabHeader.h"
#import "LanguageManager.h"
@interface ShareTabHeader ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgImgTop;
@property (weak, nonatomic) IBOutlet UIView *countBgView;
@property (weak, nonatomic) IBOutlet UIView *rewardBgView;
@property (weak, nonatomic) IBOutlet UIImageView *ivtImg;
@property (weak, nonatomic) IBOutlet UILabel *ivtCode;
@property (weak, nonatomic) IBOutlet UILabel *byyxL;
@property (weak, nonatomic) IBOutlet UILabel *zyxL;
@property (weak, nonatomic) IBOutlet UILabel *zyqL;
@property (weak, nonatomic) IBOutlet UILabel *byjlL;
@property (weak, nonatomic) IBOutlet UILabel *zjlL;


@end
@implementation ShareTabHeader

INITFROMXIB

- (void)awakeFromNib{
    [super awakeFromNib];
    self.bgImgTop.constant = -kScreenTopMargin;
    LRViewBorderRadius(self.countBgView, 10, 0, [UIColor clearColor]);
    LRViewBorderRadius(self.rewardBgView, 10, 0, [UIColor clearColor]);
    self.ivtImg.image = [UIImage imageNamed:[LanguageManager isEnglish]?@"yqhy_text_en":@"yqhy_text_zh"];
    
}

- (IBAction)headerAction:(UIButton *)sender {
    if (self.actionBlock) {
        self.actionBlock(sender.tag - 1000);
    }
}

- (void)refreshWith:(InviteDetailModel *)model{
    
    NSMutableAttributedString *codeStr = LCAttStr(([NSString stringWithFormat:@"%@: ",LCLocalString(@"my_ivt_code")]), [UIFont boldSystemFontOfSize:12], [UIColor whiteColor]);
    [codeStr appendAttributedString:LCAttStr((model.invitationCode), [UIFont systemFontOfSize:12], [UIColor whiteColor])];
    self.ivtCode.attributedText = codeStr;
    
    self.byyxL.text = [NSString stringWithFormat:@"%@",@(model.effectiveInvitationCountThisMonth)];
    self.zyxL.text = [NSString stringWithFormat:@"%@",@(model.effectiveInvitationCountTotal)];
    self.zyqL.text = [NSString stringWithFormat:@"%@",@(model.invitationCountTotal)];
    self.byjlL.text = [NSString stringWithFormat:@"%@",@(model.invitationRewardThisMonth)];
    self.zjlL.text = [NSString stringWithFormat:@"%@",@(model.invitationRewardTotal)];
    
}



@end
